/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase202202 - Ex01
 * <p>Powered by Lisi On 2022-06-01 17:01:32
 * <p>Created by IntelliJ IDEA
 *

 * @version 1.0
 * @since 17
 */
public class Ex01 {
    public static void main(String[] args) {
        // 1+100 101
        // 2+99  101 * 50
         int a = 18;
         //要求变量名必须 见名知意
        int sss = 0;

        //此用来计算每行输出9数
        int p = 0;
        for(int n=2;n<=100;n++) {
            int i = n;
            boolean f = true;
            int t = 0;
            for (int j = 2; j <= i - 1; j++) {
                if (i % j == 0) {
                    t = j;
                    f = false;
                    break;
                }
            }
            if (f) {
                System.out.printf("% 3d ",i);
                ++p;
                if(p%9==0) {
                    System.out.println();
                }
                //System.out.printf("%d是素数", i);
                sss+=i;
            } //else {
                //System.out.printf("%d不是素数,因为你被%d整数了", i, t);
           // }

        }
        System.out.println();
        System.out.printf("1-100内素数和是：%d%n",sss);
    }
}
